using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using TMPro;

public class ItemPreviewObjectController:MonoBehaviour {

	TextMeshProUGUI text;
	RectTransform rectTransform;
	float minWidth;

	void Start() {
		text=GetComponent<TextMeshProUGUI>();
		rectTransform=transform as RectTransform;
		minWidth=rectTransform.sizeDelta.x;
	}

	void Update() {
		Vector2 size = text.textBounds.size;
		if(size.x<minWidth) size.x=minWidth;
		rectTransform.sizeDelta=size;
	}
}
